//
//  MyCollectionoforiginalmindTableViewCell.m
//  Gxj
//
//  Created by 💋索少杰 on 2017/9/20.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "MyCollectionoforiginalmindTableViewCell.h"

@implementation MyCollectionoforiginalmindTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
       
        
        //用户点击头像响应
        _iconTouxiang=[[UIButton alloc] init];
        [_iconTouxiang setBackgroundImage:[UIImage imageNamed:@"toixiang"] forState:UIControlStateNormal];
        //头像背景
        _viewIcon=[[UIView alloc] init];
        _viewIcon.backgroundColor = [UIColor lightGrayColor];
        _viewIcon.layer.masksToBounds=YES;
        _viewIcon.layer.cornerRadius=25;
        _viewIcon.layer.shadowColor = [UIColor blackColor].CGColor;
        _viewIcon.layer.shadowOffset = CGSizeMake(-5, 0);
        _viewIcon.layer.shadowOpacity = 0.5;
        _viewIcon.layer.shadowRadius = 4.0;
        _viewIcon.clipsToBounds = NO;
        [_viewIcon addSubview:_iconTouxiang];
        [self addSubview:_viewIcon];
        
        //用户名字显示
        _nameText=[[UILabel alloc] init];
        _nameText.text=@"后悔的小公主";
        _nameText.textColor=[UIColor blackColor];
        _nameText.font=[UIFont systemFontOfSize:kWidthScale(18)];
        [self addSubview:_nameText];
        
        //用户等级图标
        _dengjiTB=[[UIImageView alloc] init];
        _dengjiTB.image=[UIImage imageNamed:@"dengji1"];
        [self addSubview:_dengjiTB];
        
        //用户等级显示
        _dengjiText=[[UILabel alloc] init];
        _dengjiText.text=@"100级";
        _dengjiText.textColor=[UIColor blackColor];
        _dengjiText.font=[UIFont systemFontOfSize:kWidthScale(12)];
        [self addSubview:_dengjiText];
        
        //浏览人数图标
        _iconLiulang=[[UIImageView alloc] init];
        _iconLiulang.image=[UIImage imageNamed:@"liulan"];
        [self addSubview:_iconLiulang];
        //观看人数
        _liulangNum=[[UILabel alloc] init];
        _liulangNum.text=@"100";
        _liulangNum.textColor=[UIColor blackColor];
        _liulangNum.font=[UIFont systemFontOfSize:kWidthScale(12)];
        [self addSubview:_liulangNum];
        //用户发表内容
        _contentText=[[UILabel alloc] init];
        _contentText.text=@"什么时候觉得，数据分析真的非常有用？";
        _contentText.textColor=[UIColor blackColor];
        _contentText.font=[UIFont systemFontOfSize:kWidthScale(14)];
        [self addSubview:_contentText];
        //风暴简介标签
        _biaoqianText=[[UIButton alloc] init];
        _biaoqianText.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"shangye"]];
        [self addSubview:_biaoqianText];
        //发表时间图标
        _iconShijian=[[UIImageView alloc] init];
        _iconShijian.image=[UIImage imageNamed:@"time"];
        [self addSubview:_iconShijian];
        
        //用户发表时间
        _shijianText=[[UILabel alloc] init];
        _shijianText.text=@"5.20";
        _shijianText.textColor=[UIColor blackColor];
        _shijianText.font=[UIFont systemFontOfSize:kWidthScale(13)];
        [self addSubview:_shijianText];
        //简介内容背景View
        _jianJieView=[[UIView alloc] init];
        _jianJieView.layer.shadowColor = [UIColor blackColor].CGColor;
        _jianJieView.layer.shadowOffset = CGSizeMake(0, 5);
        _jianJieView.layer.shadowOpacity = 0.5;
        _jianJieView.layer.shadowRadius = 6.0;
        _jianJieView.layer.cornerRadius = 6.0;
        _jianJieView.clipsToBounds = NO;
        [self addSubview:_jianJieView];
        //简介内容
        _jianjieContext=[[KQlable alloc] init];
        _jianjieContext.text=@"风暴简介：个环境可凉快和包教包零零落落零零落落";
        _jianjieContext.backgroundColor = [UIColor colorWithRed:251.0/255.0 green:251.0/255.0 blue:251.0/255.0 alpha:1];
        _jianjieContext.textColor=[UIColor blackColor];
        _jianjieContext.font=[UIFont systemFontOfSize:kWidthScale(13)];
        _jianjieContext.layer.cornerRadius = kWidthScale(12);
        _jianjieContext.layer.masksToBounds = YES;
        [_jianJieView addSubview:_jianjieContext];
        //关注按钮
        _guanzhu=[[UIButton alloc] init];
        _guanzhu = [UIButton buttonWithType:UIButtonTypeCustom];
        [_guanzhu setBackgroundImage:[UIImage imageNamed:@"guanzhu"] forState:0];
        [self addSubview:_guanzhu];
        
        //最佳讨论文字
        _zuijiaText=[[UILabel alloc] init];
        _zuijiaText.text=@"最佳讨论";
        _zuijiaText.textColor=[UIColor blackColor];
        _zuijiaText.font=[UIFont systemFontOfSize:kWidthScale(14)];
        [self addSubview:_zuijiaText];
        
        //最佳用户头像
        for (int i = 0; i < 5; i++) {
            _iconZuijia = [[UIImageView alloc] initWithFrame:CGRectMake(kWidthScale(84) * (i+1) - (66*i), kHeightScale(220), kWidthScale(23), kHeightScale(23))];
            
            _iconZuijia.image=[UIImage imageNamed:@"toixiang"];
            [self addSubview:_iconZuijia];
            
        }
        
        //添加最佳用户头像
        _but=[[UIButton alloc] init];
        [_but setBackgroundImage:[UIImage imageNamed:@"tianjia"] forState:UIControlStateNormal];
        [self addSubview:_but];
        
        //适配方法
        [self setUpadapter];
    }
    return self;
}


//适配方法
- (void)setUpadapter{
    //头像背景
    _viewIcon.sd_layout
    .topSpaceToView(self, kHeightScale(10))
    .leftSpaceToView(self, kWidthScale(10))
    .widthIs(kWidthScale(100/2))
    .heightIs(kHeightScale(100/2));
    
    //用户点击头像响应
    _iconTouxiang.sd_layout
    .topSpaceToView(self.viewIcon, kHeightScale(5))
    .leftSpaceToView(self.viewIcon, kWidthScale(5))
    .widthIs(kWidthScale(80/2))
    .heightIs(kHeightScale(80/2));
    
    
    //用户名字显示
    _nameText.sd_layout
    .topSpaceToView(self, kHeightScale(18))
    .leftSpaceToView(self.viewIcon,kWidthScale(4))
    .widthIs(kWidthScale(400/2))
    .autoHeightRatio(0);
    //用户等级图标
    _dengjiTB.sd_layout
    .topSpaceToView(self.nameText, kHeightScale(4))
    .leftSpaceToView(self.viewIcon, kWidthScale(4))
    .widthIs(kWidthScale(30/2))
    .heightIs(kHeightScale(30/2));
    //用户等级显示
    _dengjiText.sd_layout
    .topSpaceToView(self.nameText, kHeightScale(4))
    .leftSpaceToView(self.dengjiTB, kWidthScale(4))
    .widthIs(kWidthScale(80/2))
    .autoHeightRatio(0);
    //浏览人数图标
    _iconLiulang.sd_layout
    .topSpaceToView(self.nameText, kHeightScale(4))
    .leftSpaceToView(self.dengjiText, kWidthScale(4))
    .widthIs(kWidthScale(16))
    .heightIs(kHeightScale(15));
    //观看人数
    _liulangNum.sd_layout
    .topSpaceToView(self.nameText, kHeightScale(4))
    .leftSpaceToView(self.iconLiulang, kWidthScale(4))
    .widthIs(kWidthScale(100/2))
    .autoHeightRatio(0);
    //用户发表内容
    _contentText.sd_layout
    .topSpaceToView(self.viewIcon, kHeightScale(20/2))
    .leftSpaceToView(self, kWidthScale(10))
    .rightSpaceToView(self, kWidthScale(10))
    .autoHeightRatio(0);
    //风暴简介标签
    _biaoqianText.sd_layout
    .topSpaceToView(self.contentText, kHeightScale(5))
    .leftSpaceToView(self, kWidthScale(10))
    .widthIs(kWidthScale(38))
    .heightIs(kHeightScale(17));
    //发表时间图标
    _iconShijian.sd_layout
    .topSpaceToView(self.contentText, kHeightScale(7))
    .leftSpaceToView(self.biaoqianText, kWidthScale(5))
    .widthIs(kWidthScale(15))
    .heightIs(kHeightScale(15));
    //用户发表时间
    _shijianText.sd_layout
    .topSpaceToView(self.contentText, kHeightScale(7))
    .leftSpaceToView(self.iconShijian, kWidthScale(5))
    .widthIs(kWidthScale(40))
    .autoHeightRatio(0);
    //简介内容背景
    _jianJieView.sd_layout
    .topSpaceToView(self.biaoqianText, kHeightScale(12))
    .leftEqualToView(self.biaoqianText)
    .rightSpaceToView(self, kWidthScale(15))
    .heightIs(kHeightScale(80));
    //简介内容
    _jianjieContext.sd_layout
    .topEqualToView(self.jianJieView)
    .leftEqualToView(self.jianJieView)
    .rightEqualToView(self.jianJieView)
    .heightIs(kHeightScale(80));
    //最佳讨论文字
    _zuijiaText.sd_layout
    .topSpaceToView(self.jianJieView, kHeightScale(25))
    .leftSpaceToView(self, kWidthScale(10))
    .widthIs(kWidthScale(60))
    .autoHeightRatio(0);
    //关注按钮
    _guanzhu.sd_layout
    .topSpaceToView(self, kHeightScale(22))
    .rightSpaceToView(self, kWidthScale(15))
    .widthIs(kWidthScale(60))
    .heightIs(kHeightScale(25));
    //添加最佳用户头像
    _but.sd_layout
    .topEqualToView(self.iconZuijia)
    .leftSpaceToView(self.iconZuijia, kWidthScale(-5))
    .widthIs(kWidthScale(23))
    .heightIs(kHeightScale(23));
    
}


@end
